﻿//快报设置
$(document).ready(function(){
	
	$("#bulletinselect").click(function(){
		$('#tt1').datagrid({
			title:'快报信息查询',
			iconCls:'icon-save',
			width:600,
			height:250,
			nowrap: false,
			striped: true,
			fit: true,
			sortName: 'id',
			sortOrder: 'desc',
			remoteSort:false,
			singleSelect:true,
			fitColumns:true,
			url:"/shopping/admin/bulltionList",
			pagination:true,
			toolbar:false,
			columns:[[
		                {field:'id',title:'编号',width:40,sortable:true},
		                {field:'name',title:'快报标题',width:180,sortable:true,},
						{field:'timeDt',title:'发布快报时间',width:80},
					]],
			toolbar:[{
				id:'btnadd',
				text:'添加快报',
				iconCls:'icon-add',
				handler:function(){
					$("#dlg-buttons").css("display","");
					$("#edit_announcement").dialog({
						width:550 ,
						height:570 ,
						title:'发布快报' ,
						left: '330px' ,
						modal:true ,
						content:"<table width=100% ><tr style=height:'40px';vertical-align:middle;><td width='70px' align='right'>标题：</td><td><input style=width:'280px';line-height:40px;height:30px type='text' name='newannouncement_title'/>"
						+ "</td></tr><tr  style='height:400px;vertical-align: text-top;'><td width='70px' align='right' v>"
						+ "正文：</td><td><textarea name='newannouncement_content' cols=50 rows=25></textarea></td></tr></table>",
						buttons:"#dlg-buttons"
					});
				},

			},'-',{
				id:'btnsearch',
				text:'查看详细信息',
				iconCls:'icon-search',
				handler:function(){
					var selected = $('#tt1').datagrid('getSelected');
					if (selected){
						var href='/shopping/main/oneBulltion?id='+selected.id;
						window.open(href,'','width=500,height=400');
						return false;
					}else{
						alert("请选定行！");
					}
				}
			}
			],
			
		});
		
		$("#savebtn").click(function(){
			$.post('../admin/bulltionInsert' , {name:$("input[name='newannouncement_title']").val(),content:$("textarea[name='newannouncement_content']").val()},function(result){
				$("#edit_announcement").dialog("close");
			});			
	});
	});
	
});